<template>
  <div class="contentA">
    <p :style="{ color: dataObj.color }">this is childA</p>
    <button @click="changeColor">改变color</button>
  </div>
</template>

<script>
export default {
  inject: ['dataObj'],
  methods: {
    changeColor() {
      let color = this.dataObj.color === 'pink' ? 'blue' : 'pink'
      this.dataObj.changeColor(color)
    }
  }
}
</script>

<style>
.contentA {
  padding: 50px;
  border: 1px solid rgb(120, 148, 88);
}
</style>
